package com.atguigu.oss.controller;

import com.atguigu.commonutils.Result;
import com.atguigu.oss.service.OssService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/edu/oss/file")
//@CrossOrigin
public class OssController {
    @Resource
    private OssService ossService;

    @PostMapping("fileUpload")
    public Result uploadOssFiles(MultipartFile file) {
        String url = ossService.uploadFileAvatar(file);
        return Result.ok(url);
    }
}
